package com.aaa.commonmethods;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2022/11/1
 */
public class SetPriorityDemo extends Thread{
    public SetPriorityDemo(String name) {
        super(name);
    }

    @Override
    public void run() {
        super.run();
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+"~~~~~~"+i);
        }
    }
}
class Test03{
    public static void main(String[] args) {
        SetPriorityDemo spd1 = new SetPriorityDemo("线程A");
        SetPriorityDemo spd2 = new SetPriorityDemo("线程B");
        SetPriorityDemo spd3 = new SetPriorityDemo("线程C");
        //setPriority优先级1~10之间，数值越大线程先执行的概率越大
        spd1.setPriority(10);
        spd1.start();
        spd2.start();
        spd3.start();
    }
}